/*
 * @Description: 
 * @Author: Jimmy
 * @Date: 2023-07-23 12:23:35
 * @LastEditTime: 2023-07-23 20:06:31
 * @LastEditors:  
 */
import KoaRouter from 'koa-router'
const router = new KoaRouter({ prefix: '/sys' });
import systemController from '../controller/system.controller';
import { cryptPassword, userValidator, verifyUser, verifyLogin } from '../middleware/system.middleware';
import { auth } from '../middleware/auth.middleware';

//注册
router.post('/register', userValidator, verifyUser, cryptPassword, systemController.register);

//登录
router.post('/login', userValidator, verifyLogin, systemController.login);

//小程序手机号授权登录
router.post('/wxlogin',systemController.wxLogin)

router.use(auth)
//修改密码
router.patch('/password',cryptPassword, systemController.updatePassword)

//获取用户权限
router.get('/permission', systemController.getPermission)

//上传图片文件
router.post('/upload', systemController.upload)

export default router